<?php

/* Logout functies */
function logoutFromSubPage()
{
	//echo('logoutFromSubPage()');
	global $wsdl;

	$sugar_client = new nusoapclient($wsdl, true);
    $session_id = $_SESSION['session'];

    //destroy session sugarcrm
	$result = $sugar_client->call('portal_logout',array('session'=>$session));

	//destroy sessions local
	session_unset();
	session_destroy();

	header("Location: ../");
}

function logoutFromIndex()
{
	//echo('logoutFromIndex()');
	global $wsdl;

	$sugar_client = new nusoapclient($wsdl, true);
    $session_id = $_SESSION['session'];

    //destroy session sugarcrm
	$result = $sugar_client->call('portal_logout',array('session'=>$session));

	//destroy sessions local
	session_unset();
	session_destroy();

	header("Location: index.php");
}

?>